import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        final int[] array = {1,2,3,4,5};
//        array = {4,5,6,7};
//        array = new int[]{4,5,6,7};
        String str1 = null;// str1 这个引用，不指向任何对象
        String str2 = "";// str2 这个引用，指向的字符串是空的，长度为0
        System.out.println(str2.length());
    }
    public static void main9(String[] args) {
        String str2 = "11";
        String str1 = "11";
        int x = 9;
        int y = 9;
        System.out.println(x==y);// 简单的数据类型，可以双等号比较
        System.out.println(str1.equals(str2));// 比较字符串类型指向的对象时，要使用 equals方法
        System.out.println("=================");
        String str3 = "12";
        int z = 8;
        System.out.println(x==z);
        System.out.println(str1.equals(str3));
    }


    public static void main8(String[] args) {
        String str1 = "11";
        String str2 = new String("1")+ new String("1");
        System.out.println(str1==str2);
    }


    public static void main7(String[] args) {
        String str1 = "hello";
        String str2 = "he";
        String str3 = str1+"llo";
        System.out.println(str1 == str3);
    }


    public static void main6(String[] args) {
        String str1 = "hello";
        String str2 = "he"+"llo";
        System.out.println(str1 == str2);
    }

    public static void main5(String[] args) {
        String str1 = "hello";
        String str2 = "hello";
        System.out.println(str1==str2);
    }

    public static void main4(String[] args) {
        String str1 = "hello";
        String str2 = new String("hello");
        System.out.println(str1 == str2);
    }

    public static void func(String s,char[] array){
        s = "author";
        array[0] = 'p';
    }
    public static void main3(String[] args) {
        String str = "abcd";
        char[] chars = {'y','o','u'};
        func(str,chars);
        System.out.println(str);
        System.out.println(Arrays.toString(chars));
    }


    public static void main2(String[] args) {
        String str = "abcef";
        String str2 = str;
        System.out.println(str);
        System.out.println(str2);
        System.out.println("============");
        str = "author";
        System.out.println(str);
        System.out.println(str2);
    }

    public static void main1(String[] args) {
        String str ="abcdef";
        String str2 = new String("abcdef");
        char[] chars = {'a','b','c'};
        String str3 = new String(chars);
        System.out.println(str3);

    }
}
